package com.zsx.shopping.user.config;

import javax.annotation.Resource;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.zsx.shopping.user.interceptor.LoginInterceptor;

@Configuration
public class UserWebConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterceptor loginInterceptor;
    
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
            .addPathPatterns("/**")
            .excludePathPatterns(
                    "/user/user/login",
                    "/user/user/register",
                    "/user/user/exist",
                    "/user/receiveAddress/seckill/defaultReceiveAddress"
            );
    }
}
